//Τιμοκαταλογος που μπορει να τροποποιησει ενας χρηστης(καταστηματαρχης)
package Controllers;

import DAO.PriceList_Dao;
import Exceptions.DaoException;
import Models.PriceList;
import Interfaces.IPriceList_Dao;
import javax.swing.JOptionPane;

public class PriceList_Controller {

    PriceList_Controller() {

    }

    public PriceList_Controller(PriceList_Dao priceList_Dao) {

    }

    public boolean Validate(String fmpoukali, String fpoto, String fmpyra, String fsfinaki, String fmiso, String kmpoukali, String kpoto, String kmpyra, String ksfinaki, String kmiso)
            throws IllegalArgumentException, DaoException {
        boolean x = true;
        if (fmpoukali.isEmpty() || fpoto.isEmpty() || fmpyra.isEmpty() || fsfinaki.isEmpty() || fmiso.isEmpty() || kmpoukali.isEmpty() || kpoto.isEmpty() || kmpyra.isEmpty() || ksfinaki.isEmpty() || kmiso.isEmpty()) {
            //JOptionPane.showMessageDialog(null, "Empty Field");
            x = false;
        } else if (fmpoukali.matches("[0-9]+") == false || fpoto.matches("[0-9]+") == false || fmpyra.matches("[0-9]+") == false || fsfinaki.matches("[0-9]+") == false || fmiso.matches("[0-9]+") == false || kmpoukali.matches("[0-9]+") == false || kpoto.matches("[0-9]+") == false || kmpyra.matches("[0-9]+") == false || ksfinaki.matches("[0-9]+") == false || kmiso.matches("[0-9]+") == false) {
            // JOptionPane.showMessageDialog(null, "There is a non-digit field.");
            x = false;
        } else if (fmpoukali.length() > 2 || kmpoukali.length() > 3 || fpoto.length() > 1 || kpoto.length() > 2 || fmpyra.length() > 1 || kmpyra.length() > 1 || fsfinaki.length() > 1 || ksfinaki.length() > 1) {
            // JOptionPane.showMessageDialog(null, "Prices need to be reasonable");
            x = false;
        }

        return x;

    }
}
